<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="*|/"><xsl:apply-templates/></xsl:template>
<xsl:template match="text()|@*"><xsl:value-of select="."/></xsl:template>
<xsl:template match='nbsp' name='nbsp'>
<xsl:text disable-output-escaping='yes'>&amp;nbsp;</xsl:text>
</xsl:template>

<xsl:template match="onlineusers/freak">

<table class="body" border="0" cellspacing="0" cellpadding="1" width="100%">
<tr bgcolor="#f4ebce" height="30px">

	<td colspan="8"  class="CDBhead"  align="center">
		<b>Chi e' online dello staff?</b>
	</td>
</tr>


<xsl:if test="not (count(user[(floor( xmldatacache/extension/@uStatus div 32 ) mod 2) or (floor( xmldatacache/extension/@uStatus div 16 ) mod 2) or (floor( xmldatacache/extension/@uStatus div 4 ) mod 2)]) &gt; 0)">
<tr>
<td>
<div class="dotted"  style="position:relative; top:10px; padding-left:4px; padding-top:4px; padding-right:4px; padding-bottom:4px" border-color="red" align="center">

Purtoppo in questo momento, nessun membro dello staff e' <b>online</b>.
</div>
</td>
</tr>
</xsl:if>

<xsl:if test="count(user[(floor( xmldatacache/extension/@uStatus div 32 ) mod 2) or (floor( xmldatacache/extension/@uStatus div 16 ) mod 2) or (floor( xmldatacache/extension/@uStatus div 4 ) mod 2)]) &gt; 0">

<xsl:for-each select="user[(floor( xmldatacache/extension/@uStatus div 32 ) mod 2) or (floor( xmldatacache/extension/@uStatus div 16 ) mod 2) or (floor( xmldatacache/extension/@uStatus div 4 ) mod 2)]">

<xsl:variable name="smile">
	<xsl:choose>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 0">
			/imgs/ecool.gif
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 1">
			/imgs/ewink.gif
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 2">
			/imgs/elove.gif
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 3">
			/imgs/etongue.gif
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 4">
			/imgs/ecrazy.gif
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 5">
			/imgs/ehappy.gif
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 6">
			/imgs/esmile.gif
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 7">
			/imgs/eeyes.gif
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 8">
			/imgs/econfused.gif
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 9">
			/imgs/esad.gif
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 10">
			/imgs/eangry.gif
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) )">
			/imgs/eqmark.gif
		</xsl:when>
		<xsl:otherwise>
			/imgs/spacer.gif
		</xsl:otherwise>
	</xsl:choose>
</xsl:variable>

<xsl:variable name="emoDescr">
	<xsl:choose>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 0">
			Oggi mi sento troppo figo/a!
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 1">
			Ci siamo capiti...
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 2">
			Ho una cotta in corso!
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 3">
			Oggi sono arrapato!
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 4">
			Oggi non ci sto con la testa!
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 5">
			Sto troppo bene!
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 6">
			Sto bene!
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 7">
			Mhh... Boh... Ci devo pensare...
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 8">
			Mi sta prendendo la depressione...
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 9">
			Nessuno mi vuole bene!
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) ) and @emo = 10">
			Oggi mi girano!
		</xsl:when>
		<xsl:when test="( (floor( xmldatacache/extension/@settings div 1024 ) mod 2)  or (floor( xmldatacache/extension/@settings div 2048 ) mod 2) )">
			???
		</xsl:when>
		<xsl:otherwise>

		</xsl:otherwise>
	</xsl:choose>
</xsl:variable>


	<tr bgcolor="#f4efdf">
	<td class="CDB">&#160;</td>
	<td class="CDB" width="21">
	<xsl:choose>
	<xsl:when test='@certified = 1'><a class="nick" href="/profileShow.aspx?userGuid={@userid}"><img border="0" style="margin-left:2px;" src="/imgs/cert.gif"/></a></xsl:when>
	<xsl:otherwise>
	&#160;
	</xsl:otherwise>
	</xsl:choose>
	</td>
	<td class="CDB" align="center" width="28">
	<xsl:choose>
	<xsl:when test='@cg &gt; 0'><a class="nick" href="/userinfo/latest.aspx?userGuid={@userid}"><img border="0" style="margin-left:2px;" src="/imgs/pics.gif"/></a></xsl:when>
	<xsl:when test='string-length(@thumb) &gt; 0'><a href="/profileShow.aspx?userGuid={@userid}"><img border="0" style="margin-left:2px;" src="/imgs/foto.gif"/></a></xsl:when>
	<xsl:otherwise>
	&#160;
	</xsl:otherwise>
	</xsl:choose>
	</td>
	<td class="CDB" width="21px">
	<xsl:choose>
	<xsl:when test='@cb &gt; 0 and floor( xmldatacache/extension/@settings div 8192 ) mod 2'><a class="nick" href="/userinfo/blog.aspx?userid={@userid}"><img border="0" style="margin-left:2px;" src="/imgs/blog.gif"/></a></xsl:when>
	<xsl:otherwise>
	&#160;
	</xsl:otherwise>
	</xsl:choose>
	</td>
	<td class="CDB" width="8px">
	<a href="/help/loginemotivo.aspx"><img border="0" alt="{$emoDescr}" src="{$smile}"/></a>
	</td>
	<td class="CDB">
	<xsl:choose>
	<xsl:when test='@sexid="24" or @sexid="26"'><img src="/imgs/male.gif"/></xsl:when>
	<xsl:when test='@sexid="25" or @sexid="27"'><img src="/imgs/female.gif"/></xsl:when>
	</xsl:choose>
	</td>
	<td class="CDB" style="padding-left:5px;padding-right:5px;">
		<xsl:choose>
			<xsl:when test='/onlineusers/freak/user/@loggedUser=@userid'>
				<!-- se sono io -->
				<a class="body_red" href="/profileShow.aspx?userGuid={@userid}">
				<b><xsl:value-of select="@nick"/></b>
				</a>
			</xsl:when>
			<xsl:when test='@buddy=@userid'>
				<!-- se e' nella lista amichetti -->
				<a class="nick" href="/profileShow.aspx?userGuid={@userid}">
				<b><xsl:value-of select="@nick"/></b>
				</a>
			</xsl:when>
			<xsl:otherwise>
				<a class="nick" href="/profileShow.aspx?userGuid={@userid}">
				<xsl:value-of select="@nick"/>
				</a>
			</xsl:otherwise>
		</xsl:choose>
	</td>
	<td class="CDB" align="center" width="50%"><nobr><xsl:value-of select="@city"/></nobr></td>
	</tr>


	</xsl:for-each>
</xsl:if>
</table>
</xsl:template>

</xsl:stylesheet>